<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of modules
 *
 * @author chandu
 */
include "base.php";
include CONFIG_PATH . 'errors.php';

class modules extends baseController {

    public $mod;
    public $reslt;
    public $errors;

    public function __construct() {
        parent::__construct();
        $this->mod = new model();
        $this->errors = new errors();
    }

    public function invoke() {
        //this code is to add+ modules 
        $this->show("modules/index");
        if ($_POST) {
            $reslt = $this->mod->add($this->tables->table4, $_POST, "submit");
            if ($reslt) {
                $msg = $this->errors->module_inserted_successfully;
                echo ("<SCRIPT LANGUAGE='JavaScript'>
                       window.alert('$msg');
                      </SCRIPT>");
            } else {

                $msg = $this->errors->default_failed;
                echo ("<SCRIPT LANGUAGE='JavaScript'>
                       window.alert('$msg');
                      </SCRIPT>");
            }
        }
    }

}

$obj = new modules();
$obj->invoke();
